const db = require('../config/db')
const dbserver=require('../dao/dbserver')

exports.getUserList=(req,res)=>{
    let data=req.body
    // console.log(req.body,'data');
    dbserver.getUserList(data,res)
}
exports.sendMsg=(req,res)=>{
    let {uid,fid,msg,type}=req.body;
    // console.log(uid,fid,msg,type);
    dbserver.insertMsg(uid,fid,msg,type,res)
}
exports.getLastMessage=(req,res)=>{
    let data=req.body
    // console.log(data,'data');
    dbserver.getLastMessage(data,res)
}
exports.getMsgCountsOfUnread=(req,res)=>{
    let data=req.body 
    dbserver.getMsgCountsOfUnread(data,res)
}

exports.cleanUnreadMsg_u=(req,res)=>{
    // console.log(req.body,'req');
    let data=req.body
    console.log(data,'data');
    dbserver.cleanUnreadMsg_u(data,res)
}

// 获取群列表 包括未读群消息
exports.getGroupList=(req,res)=>{
    let data=req.body
    dbserver.getGroupList(data,res)
}

// 获取群最后一条消息
exports.getGroupLastMessage=(req,res)=>{
    let data=req.body
    dbserver.getGroupLastMessage(data,res)
}
// 清空未读消息
exports.cleanUnreadMsg_g=(req,res)=>{
    let data=req.body
    dbserver.cleanUnreadMsg_g(data,res)
}